package io.github.eric.urpc.core.rpc;

import java.net.SocketAddress;

public class RpcContext {
    private final String connId;
    private final String applicationName;
    private final String applicationId;
    private final SocketAddress localAddress;
    private final SocketAddress remoteAddress;

    public RpcContext(String connId, String applicationName, String applicationId,
                      SocketAddress local, SocketAddress remote) {
        this.connId = connId;
        this.applicationName = applicationName;
        this.applicationId = applicationId;
        this.localAddress = local;
        this.remoteAddress = remote;
    }

    public String getConnId() {
        return connId;
    }

    /**
     * 当连接还未注册成功时，可能是null
     */
    public String getApplicationName() {
        return applicationName;
    }

    /**
     * 当连接还未注册成功时，可能是null
     */
    public String getApplicationId() {
        return applicationId;
    }

    public SocketAddress getLocalAddress() {
        return localAddress;
    }

    public SocketAddress getRemoteAddress() {
        return remoteAddress;
    }
}
